@echo off
chcp 65001 >nul
title 拾取窗中流光安装器

echo ================================================================
echo                     ✨ 拾取窗中流光 v2.0
echo                        现代化安装程序
echo                        作者: adnaan
echo ================================================================
echo.

echo 🔍 检查Python环境...
python --version >nul 2>&1
if %errorlevel% neq 0 (
    echo ❌ Python未安装或未添加到PATH
    echo 请先安装Python 3.8+: https://python.org/downloads/
    pause
    exit /b 1
)

echo ✅ Python环境正常

echo.
echo 🔧 安装依赖包...
python -m pip install --upgrade pip
python -m pip install -r requirements.txt

if %errorlevel% neq 0 (
    echo ❌ 依赖安装失败
    pause
    exit /b 1
)

echo ✅ 依赖安装完成

echo.
echo 🚀 创建桌面快捷方式...
set SCRIPT_DIR=%~dp0
set DESKTOP=%USERPROFILE%\Desktop
set SHORTCUT_PATH=%DESKTOP%\拾取窗中流光.lnk

echo Set oWS = WScript.CreateObject("WScript.Shell") > CreateShortcut.vbs
echo sLinkFile = "%SHORTCUT_PATH%" >> CreateShortcut.vbs
echo Set oLink = oWS.CreateShortcut(sLinkFile) >> CreateShortcut.vbs
echo oLink.TargetPath = "python" >> CreateShortcut.vbs
echo oLink.Arguments = """%SCRIPT_DIR%run.py""" >> CreateShortcut.vbs
echo oLink.WorkingDirectory = "%SCRIPT_DIR%" >> CreateShortcut.vbs
echo oLink.IconLocation = "%SCRIPT_DIR%icon.ico" >> CreateShortcut.vbs
echo oLink.Description = "拾取窗中流光 v2.0 - 作者: adnaan" >> CreateShortcut.vbs
echo oLink.Save >> CreateShortcut.vbs

cscript CreateShortcut.vbs >nul 2>&1
del CreateShortcut.vbs >nul 2>&1

if exist "%SHORTCUT_PATH%" (
    echo ✅ 桌面快捷方式已创建
) else (
    echo ⚠️ 快捷方式创建失败，请手动运行 run.py
)

echo.
echo 🎉 安装完成！
echo.
echo 📝 使用说明:
echo   1. 双击桌面快捷方式启动程序
echo   2. 程序会在系统托盘运行
echo   3. 右键托盘图标打开控制面板
echo   4. 配置Webhook URL后开始监控
echo.
echo 💡 提示: 程序会自动检查依赖并引导配置
echo.
pause 